package com.mt.mtbusinessmanagementsystem.utils.product.level;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.*;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;

@Builder
@Repository
@Data
@AllArgsConstructor
@NoArgsConstructor
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class ThirdLevel implements ProductClassLevel{
    private Integer thirdClassificationId;
    private String thirdClassificationName;
    private List<FourthLevel> dataList;

    public static ThirdLevel fromProductClassLevel(ProductClassLevel productClassLevel) {
        if (productClassLevel instanceof ThirdLevel) {
            return (ThirdLevel) productClassLevel;
        } else {
            throw new IllegalArgumentException("不能转换为ThirdLevel类");
        }
    }
}
